home *** CD-ROM | disk | FTP | other *** search
- DECLARE FUNCTION FindFile$ (spec$, atrb%)
- DECLARE FUNCTION FileYear% ()
- DECLARE FUNCTION FileMonth% ()
- DECLARE FUNCTION FileDay% ()
- DECLARE FUNCTION FileHrs% ()
- DECLARE FUNCTION FileMin% ()
- DECLARE FUNCTION FileSec% ()
- DECLARE FUNCTION FileSize& ()
- DECLARE FUNCTION FileAtrb% ()
- DECLARE FUNCTION FileFound% ()
- DECLARE FUNCTION FileError% ()
- DEFINT A-Z
- '
- '----------------------------------------------------------------------------
- ' AHNUTS.BAS
- ' Example PDS code to be used with "AHNUTS.ASM" library.
- ' See "AHNUTS.ASM" for further documentation.
- ' Written and placed in the PUBLIC DOMAIN by: Lewis E. Balentine
- ' Version date: 20 June 1992
- '----------------------------------------------------------------------------
- CLS
- spec$ = UCASE$(LTRIM$(RTRIM$(COMMAND$)))
- ' The next two lines were used for debugging.
- ' spec$ = "c:\*.*"
- ' SHELL "DIR " + spec$
-
- IF spec$ = "" THEN
- PRINT "Simple program to demonstrate 'AHNUTS.ASM' library for MS-PDS."
- PRINT " Prints directory listing in the format:"
- PRINT " FILENAME.EXT LL MM/DD/YYYY HH:MM:SS ZZZ,ZZZ,ZZZ AA"
- PRINT " Where: LL = length of filename"
- PRINT " MM = month"
- PRINT " DD = day"
- PRINT " YYYY = year"
- PRINT " HH = hour"
- PRINT " MM = minute"
- PRINT " SS = second"
- PRINT " ZZZ,ZZZ,ZZZ = file size"
- PRINT " AA = file atribute if not zero"
- PRINT " Syntax: AHNUTS FileSpec (Default = *.*)"
- PRINT " ... Press any key to continue .... (ESC to abort)"
- k$ = "": WHILE k$ = "": k$ = INKEY$: WEND
- IF k$ = CHR$(27) THEN END
- spec$ = "*.*"
- END IF
-
- ' check spec string termination
- IF RIGHT$(spec$, 1) = "\" THEN spec$ = spec$ + "*.*"
- IF RIGHT$(spec$, 1) = ":" THEN spec$ = spec$ + "*.*"
-
- ' try to avoid obvious DOS crital error
- IF LEFT$(spec$, 2) = "A:" THEN
- PRINT "Places disk in drive A: and press any key ..."
- k$ = "": WHILE k$ = "": k$ = INKEY$: WEND
- END IF
- IF LEFT$(spec$, 2) = "B:" THEN
- PRINT "Places disk in drive B: and press any key ..."
- k$ = "": WHILE k$ = "": k$ = INKEY$: WEND
- END IF
-
- ' for your information
- CONST subdirectory = 16
- CONST hidden = 2
- CONST readonly = 1
- CONST volume = 8
- CONST archive = 32
-
- atrb% = subdirectory + hidden + readonly
-
- a$ = FindFile$(spec$, atrb%) ' first call to library function
- l = 0
- WHILE a$ <> ""
- l = l + 1
- PRINT a$, ;
- PRINT USING "## "; LEN(a$);
- PRINT USING "##/"; FileMonth%;
- PRINT USING "##/"; FileDay%;
- PRINT USING "#### "; FileYear%;
- PRINT USING "##:"; FileHrs%;
- PRINT USING "##:"; FileMin%;
- PRINT USING "## "; FileSec%;
- PRINT USING "###,###,###"; FileSize&;
- IF FileAtrb% <> 0 THEN
- PRINT , FileAtrb%
- ELSE
- PRINT
- END IF
- IF l = 24 THEN
- PRINT "Press any key to continue ....(ESC to abort)";
- k$ = "": WHILE k$ = "": k$ = INKEY$: WEND
- l = 0: PRINT
- IF k$ = CHR$(27) THEN END
- END IF
- a$ = FindFile$("", 0)
- WEND
- PRINT "Found "; FileFound%; " files. Last error ="; FileError%
- END
-
-